feat: Add Kelly Criterion Bankroll Growth Tool#658
Conversation
Adds the Kelly Criterion Bankroll Growth Tool to the math_explorer_gui. It simulates multiple iterations of a fractional Kelly strategy and visualizes the growth using `egui_plot`. The architecture adheres to the Strategy Pattern by introducing a `FinancialMathTab` and `FinancialMathTool`. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Pull request overview
Adds a new Financial Math domain tab to the GUI and introduces a Kelly Criterion bankroll growth simulator/visualizer, wiring it into the app’s tab navigation and marking the roadmap item complete.
Changes:
- Added
FinancialMathTab/FinancialMathToolscaffolding and registered the new tab. - Implemented
BankrollGrowthToolto simulate and plot bankroll trajectories for full/half/quarter Kelly. - Updated the GUI roadmap (
todo_gui.md) to mark the bankroll growth feature as done.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| todo_gui.md | Marks the Kelly “Bankroll Growth” GUI feature as completed. |
| math_explorer_gui/src/tabs/mod.rs | Registers the new financial_math tab module. |
| math_explorer_gui/src/tabs/financial_math/mod.rs | Adds the Financial Math tab + tool-selection scaffolding. |
| math_explorer_gui/src/tabs/financial_math/bankroll_growth.rs | Implements the Kelly bankroll simulation UI + plotting. |
| math_explorer_gui/src/tabs/battery_degradation/lifetime_estimator.rs | Formatting-only import cleanup. |
| math_explorer_gui/src/tabs/ai/attention_maps.rs | Formatting-only line wrapping / layout changes. |
| math_explorer_gui/src/app.rs | Wires FinancialMathTab into the main tab list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| self.error_msg = Some(format!("Error: {:?}", e)); // e is an enum | ||
| } | ||
| } | ||
| } | ||
| (Err(e), _) => { | ||
| self.error_msg = Some(format!("Error: {:?}", e)); | ||
| } | ||
| (_, Err(e)) => { | ||
| self.error_msg = Some(format!("Error: {:?}", e)); |
| /// A trait for sub-tools within the Financial Math tab. | ||
| pub trait FinancialMathTool { | ||
| /// Returns the name of the tool. | ||
| fn name(&self) -> &'static str; | ||
|
|
||
| /// Renders the tool's UI. | ||
| fn show(&mut self, ui: &mut egui::Ui); | ||
| } |
| let mut tool = Self { | ||
| initial_bankroll: 1000.0, | ||
| probability: 0.55, | ||
| odds: 2.0, // Decimal odds (net profit multiplier + 1, wait Kelly odds b is net profit multiplier. The Odds type in math_explorer: Odds::new(b). Let's check.) |
| |bankroll: &mut f64, fraction: &BankrollFraction| { | ||
| let bet_amount = *bankroll * fraction.value(); | ||
| if win { | ||
| *bankroll += bet_amount * o.value(); |
| .add(egui::Slider::new(&mut self.odds, 0.1..=10.0).text("Net Odds (b)")) | ||
| .on_hover_text("Net profit multiplier. E.g., for +100 / even money, b = 1.0.") |
FinancialMathTabandFinancialMathToolto implement Strategy Pattern.BankrollGrowthToolto simulate and visualize Kelly Criterion bankroll growth.math_explorer_gui/src/tabs/mod.rsandmath_explorer_gui/src/app.rsto wire up the new tab.todo_gui.mdto mark the feature as complete.PR created automatically by Jules for task 4295028225575539465 started by @fderuiter